package br.com.comanda.customadapters;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import br.com.comanda.R;
import br.com.comanda.vos.Board;

public class BoardAdapter extends ArrayAdapter<Board> {

	/*
	 * Used to instantiate layout XML file into its corresponding View objects
	 */
	private final LayoutInflater inflater;

	/*
	 * each list item layout ID
	 */
	private final int resourceId;

	public BoardAdapter(Context context, int resource, List<Board> objects) {
		super(context, resource, objects);
		this.inflater = LayoutInflater.from(context);
		this.resourceId = resource;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		final Board board = getItem(position);

		convertView = this.inflater.inflate(this.resourceId, parent, false);

		TextView boardName = (TextView) convertView.findViewById(R.id.tvBoardName);
		boardName.setText(board.getBoard());

		return convertView;
	}
}
